package com.happly.happlycloud.controller.backend;

import com.github.pagehelper.PageInfo;
import com.happly.happlycloud.common.ServerResponse;
import com.happly.happlycloud.service.IOrderService;
import com.happly.happlycloud.vo.OrderVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/manage/order")
@Api("订单管理后台")
public class OrderManageController {

    @Autowired
    private IOrderService iOrderService;

    @RequestMapping("list.do")
    @ApiOperation("添加")
    public ServerResponse<PageInfo> orderList(@RequestParam(value = "pageNum",defaultValue = "1") int pageNum,
                                              @RequestParam(value = "pageSize",defaultValue = "10")int pageSize){

        //填充增加产品的业务逻辑
        return iOrderService.manageList(pageNum,pageSize);
    }

    @RequestMapping("detail.do")
    @ApiOperation("添加")
    public ServerResponse<OrderVo> orderDetail( Long orderNo){

        return iOrderService.manageDetail(orderNo);
    }

    @RequestMapping("search.do")
    @ApiOperation("添加")
    public ServerResponse<PageInfo> orderSearch( Long orderNo,@RequestParam(value = "pageNum",defaultValue = "1") int pageNum,
                                               @RequestParam(value = "pageSize",defaultValue = "10")int pageSize){
        //填充我们增加产品的业务逻辑
        return iOrderService.manageSearch(orderNo,pageNum,pageSize);
    }
}
